package com.openflag.bwicservice.service.impl;

import com.openflag.bwicservice.domain.Bwic;
import com.openflag.bwicservice.domain.CheckBwicRequest;
import com.openflag.bwicservice.domain.Result;
import com.openflag.bwicservice.repository.BwicRepository;
import com.openflag.bwicservice.service.SaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import static com.openflag.bwicservice.domain.ResultStatus.*;
import static com.openflag.bwicservice.util.ResultUtil.*;

import java.util.List;
import java.util.Optional;

@Service
public class SaleServiceImpl implements SaleService {

    @Autowired
    BwicRepository bwicRepository;

    @Override
    public Result<List<Bwic>> uncheckBwicList(){
        Optional<List<Bwic>> bwicList = bwicRepository.getUncheckedBwicList();
        if (!bwicList.isPresent()){
            return success(null);
        }

        return success(bwicList.get());



    }
}
